﻿using PlaceOrder_Core.PlaceOrderModels;
using PlaceOrder_Core.Services.Instances;
using PlaceOrder_Shared.Models.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlaceOrder_Core.Models.QuanYi
{
    public class QuanYiOrderServerResponseClass : QuanYiServerBaseClass
    {
        public QuanYiOrderServerResponseClass()
        {
            Token = UserHelper.Token;
            UserID = UserHelper.UserID;
            Code = 0;
        }
        public QuanYiOrderServerResponseClass(QuanYiOrderServerResponseClass qsr)
        {
            Trade = qsr.Trade;
        }
        public UserTrade Trade { get; set; }
        public int BrokerID { get; set; }
        public List<string> ChatMessages { get; set; }

        public string ChatMessage { get; set; }

        public byte[] ChatImage { get; set; }

        /// <summary>
        /// 0代表普通客户端，1代表管理端
        /// </summary>
        public int RoleType {  get; set; }


        /// <summary>
        /// 申请复议的内容
        /// </summary>
        public string RequestReviewMessage { get; set; }


        /// <summary>
        /// 刘老师发来的改价重定向的tradeIds
        /// </summary>
        public string ChangePriceIds { get; set; }

        /// <summary>
        /// 检测到新消息
        /// </summary>
        public List<ChatMessage> NewChatMessageList { get; set; }

        public bool IsIndex { get; set; } //标记是否是indexviewmodel即orderlistviewmodel的



        public override string ToString()
        {
            return $"QuanYiOrderServerResponseClass: " +
                   $"Token={Token}, " +
                   $"UserID={UserID}, " +
                   $"Code={Code}, " +
                   $"Trade={Trade}, " +
                   $"BrokerID={BrokerID}, " +
                   $"ChatMessages={string.Join(", ", ChatMessages ?? new List<string>())}, " +
                   $"ChatMessage={ChatMessage}, " +
                   $"ChatImage={(ChatImage != null ? Convert.ToBase64String(ChatImage) : "null")}, " +
                   $"RoleType={RoleType}, " +
                   $"RequestReviewMessage={RequestReviewMessage}, " +
                   $"ChangePriceIds={ChangePriceIds}, " +
                   $"IsIndex={IsIndex}";
        }


    }
}
